#include "BaseMoveable.h"


BaseMoveable::BaseMoveable(sf::RenderWindow *App) : BaseEntity(App)
{
	Velocity = sf::Vector2f();
	AngularVelocity = 0;
}

void BaseMoveable::CreatePhysics() //An array of points
{
	PhysicsEnabled = true;
	PhysObj = new PhysicsObject(pRender);
	PhysObj->SetPos(GetPos());
}

void BaseMoveable::Tick()
{
	if (PhysicsEnabled == true)
	{
		PhysObj->Tick();
	}
	else
	{
		float delta = GameGlobals::Instance()->FrameTime;
		SetPos(GetPos() + (GetVelocity() * delta));
		SetAngle(Angle + (AngularVelocity * delta));
	}
	BaseEntity::Tick();
}

BaseMoveable::~BaseMoveable(void)
{
	if (PhysicsEnabled == true)
	{
		delete GetPhysicsObject();
	}
}
